import { S } from '../../s';
import { IPSAppDEDataSet } from '../../app/dataentity/ipsapp-dedata-set';
import { IPSAppDEReport } from '../../app/dataentity/ipsapp-dereport';
import { IPSAppDEReportItem } from '../../app/dataentity/ipsapp-dereport-item';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSDEReport } from './ipsdereport';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEReportImpl
  extends PSModelObjectImpl
  implements IPSDEReport, IPSAppDEReport
{
  get codeName(): string {
    return this.M.codeName;
  }

  get contentType():
    | 'PDF'
    | 'HTML'
    | 'DOCX'
    | 'EXCEL'
    | 'JSON'
    | 'XML'
    | 'TEXT'
    | 'USER'
    | 'USER2' {
    return this.M.contentType;
  }

  protected psappdedataset: IPSAppDEDataSet;
  getPSAppDEDataSet(): IPSAppDEDataSet | null {
    if (this.psappdedataset != null) return this.psappdedataset;
    const value = this.M.getPSAppDEDataSet;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getParentPSModelObject(
      S._f,
    ) as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.psappdedataset = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset;
  }

  protected psappdedataset2: IPSAppDEDataSet;
  getPSAppDEDataSet2(): IPSAppDEDataSet | null {
    if (this.psappdedataset2 != null) return this.psappdedataset2;
    const value = this.M.getPSAppDEDataSet2;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getParentPSModelObject(
      S._f,
    ) as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.psappdedataset2 = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset2;
  }

  protected psappdedataset3: IPSAppDEDataSet;
  getPSAppDEDataSet3(): IPSAppDEDataSet | null {
    if (this.psappdedataset3 != null) return this.psappdedataset3;
    const value = this.M.getPSAppDEDataSet3;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getParentPSModelObject(
      S._f,
    ) as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.psappdedataset3 = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset3;
  }

  protected psappdedataset4: IPSAppDEDataSet;
  getPSAppDEDataSet4(): IPSAppDEDataSet | null {
    if (this.psappdedataset4 != null) return this.psappdedataset4;
    const value = this.M.getPSAppDEDataSet4;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getParentPSModelObject(
      S._f,
    ) as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.psappdedataset4 = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset4;
  }

  protected psappdereportitems: IPSAppDEReportItem[];
  getPSAppDEReportItems(): IPSAppDEReportItem[] | null {
    return (
      this.psappdereportitems ||
      (this.psappdereportitems = this.fillChildListModel(
        this.M.getPSAppDEReportItems,
        S._3f0,
      ) as IPSAppDEReportItem[])
    );
  }

  findPSAppDEReportItem(objKey: any): IPSAppDEReportItem | null {
    return this.getPSModel5(
      S._3f0,
      this.getPSAppDEReportItems(),
      objKey,
    ) as IPSAppDEReportItem;
  }

  get reportTag(): string {
    return this.M.reportTag;
  }

  get reportTag2(): string {
    return this.M.reportTag2;
  }

  get reportType(): string {
    return this.M.reportType;
  }

  get reportUIModel(): string {
    return this.M.reportUIModel;
  }

  get sysUniResCode(): string {
    return this.M.sysUniResCode;
  }

  get enableLog(): boolean {
    return this.M.enableLog != null ? this.M.enableLog : false;
  }

  get multiPage(): boolean {
    return this.M.multiPage != null ? this.M.multiPage : false;
  }
  get cls(): string {
    return 'PSDEReportImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._3ee || cls == S._20a) return true;
    return super.instanceof(cls);
  }
}
